home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / netprog.zip / NETPROG.TAR / lib / hosterror.c < prev    next >
Text File  |  1989-12-17  |  551b  |  26 lines

  1. /*
  2.  * Return a string containing some additional information after a
  3.  * host name or address lookup error - gethostbyname() or gethostbyaddr().
  4.  */
  5.  
  6. int    h_errno;        /* host error number */
  7. int    h_nerr;            /* # of error message strings */
  8. char    *h_errlist[];        /* the error message table */
  9.  
  10. char *
  11. host_err_str()
  12. {
  13.     static char    msgstr[200];
  14.  
  15.     if (h_errno != 0) {
  16.         if (h_errno > 0 && h_errno < h_nerr)
  17.             sprintf(msgstr, "(%s)", h_errlist[h_errno]);
  18.         else
  19.             sprintf(msgstr, "(h_errno = %d)", h_errno);
  20.     } else {
  21.         msgstr[0] = '\0';
  22.     }
  23.  
  24.     return(msgstr);
  25. }
  26.